import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    isLogin: 0,
    userInfo: '',
    refreshLink: ''
  },
  mutations: {
    changeLogin(state, status) {
      state.isLogin = status
    },
    commitUserInfo(state, info) {
      state.userInfo = info
    },
    setLink(state, data) {
      state.refreshLink = data
    }
  },
  actions: {
    loginAction({ commit }, num) {
      commit('changeLogin', num)
    },
    userInfoAction({ commit }, info) {
      commit('commitUserInfo', info)
    },
    getRefresh({ commit }, data) {
      commit('setLink', data)
    }
  }
})
